package com.rock.mybatis;

import com.ulisesbocchio.jasyptspringboot.encryptor.DefaultLazyEncryptor;
import org.jasypt.encryption.StringEncryptor;
import org.springframework.core.env.StandardEnvironment;

public class PasswordEncode {

    public static void testEnvironmentProperties() {
        System.setProperty("jasypt.encryptor.password", "yeyg1n7l");
        StringEncryptor stringEncryptor = new DefaultLazyEncryptor(new StandardEnvironment());

        //加密方法
        System.out.println(stringEncryptor.encrypt("pig"));
        //解密方法
        //System.out.println(stringEncryptor.decrypt("ltJPpR50wT0oIY9kfOe1Iw=="));
    }

    public static void main(String[] args) {
        PasswordEncode.testEnvironmentProperties();
    }


}
